#ifndef  __TCP_CLI__
#define __TCP_CLI__

#include <stdlib.h>
#include<string.h>
#include <stdio.h>
#ifdef WIN32
#define PLATFORM WIN32
#include<winsock2.h>
#pragma comment(lib, "ws2_32.lib")
#endif

#ifdef linux
#define PLATFORM LINUX
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>

#endif

#ifndef PLATFORM
#warning "No PLATFORM"
#endif


#define MAX_BUF 512


#ifdef __cpluspllus
extern "C"{
#endif


typedef struct _T_TCPCli {
	char strAddr[128];
	int iPort;
	struct sockaddr_in LocalAddr;
#ifdef WIN32
	WSADATA  Ws;
	SOCKET CientSocket ;
#endif
#ifdef linux 
	int CientSocket;
#endif
     char RecvBuffer[MAX_BUF];
}TCPClient;

int TcpConnect(TCPClient *,const char *str,int port);
int TcpClose(TCPClient *p);
int TcpSend(TCPClient *p, char pStr[], int iLen);
int TcpRecv(TCPClient *p, char pStr[], int iLen);
#ifdef __cpluspllus
}
#endif

#endif // ! __TCP_CLI
